<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-04 16:53:56
 * @LastEditTime: 2023-11-11 15:35:21
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 
 */

namespace App\Http\Services\Pro;


use App\Http\Services\Service;
use App\Repositories\ProDeptRepository;

/**
 * @property ProDeptRepository $repository 
 * @author sunkaiyuan
 */
class DeptService extends Service
    {
    public function boot(ProDeptRepository $repository)
        {
        $this->repository = $repository;
        }
    protected function audit()
        {
        return $this->repository->get()->filter(function ($v)
            {
            auditSave($v, true, true, 0);
            });
        }

    protected function noaudit()
        {
        return $this->repository->get()->filter(function ($v)
            {
            auditSave($v, false, true, -1);
            });
        }
    public function list()
        {
        // DB::enableQueryLog();
        $data = $this->repository->condition(request())->getGrid();
        // dd(DB::getQueryLog());
        return $data;
        }
    protected function save()
        {
        return $this->repository->autosave(request()->toArray());
        }

    }